package com.pai4j.netty.server.config.properties;


import com.pai4j.netty.server.common.PropertyLoader;
import lombok.Getter;

@Getter
public class RocketMQConfig {

    private String namesrvAddr;

    private String producerGroup;

    private String consumerGroup;
    private String nodeConsumerGroup;

    private int producerSendMsgTimeout;

    private int consumeThreadMax;

    private int consumeThreadMin;

    public static RocketMQConfig init() {

        RocketMQConfig rocketMQConfig = new RocketMQConfig();
        rocketMQConfig.namesrvAddr = PropertyLoader.safeGetProperty("rocketmq.name-server", String.class);
        rocketMQConfig.producerGroup = PropertyLoader.safeGetProperty("rocketmq.producer.group", String.class);
        rocketMQConfig.consumerGroup = PropertyLoader.safeGetProperty("rocketmq.consumer.group", String.class);
        rocketMQConfig.nodeConsumerGroup = PropertyLoader.safeGetProperty("rocketmq.consumer.group.node", String.class);
        rocketMQConfig.producerSendMsgTimeout = PropertyLoader.safeGetProperty("rocketmq.producer.send-message-timeout", Integer.class);
        rocketMQConfig.consumeThreadMax = PropertyLoader.safeGetProperty("rocketmq.consumer.thread.max", Integer.class);
        rocketMQConfig.consumeThreadMin = PropertyLoader.safeGetProperty("rocketmq.consumer.thread.min", Integer.class);
        return rocketMQConfig;
    }
}
